from CvPythonExtensions import *
import CvEventManager

gc = CyGlobalContext()

class CvImprovementIntoFeatures(CvEventManager.CvEventManager):
	def __init__(self):
		# initialize base class
		self.parent = CvEventManager.CvEventManager
		self.parent.__init__(self)

	def onImprovementBuilt(self, argsList):
		'Improvement Built'
		iImprovement, iX, iY = argsList

                # Makes improvements turn into features.
		pPlot = CyMap().plot(iX,iY)

		if iImprovement == gc.getInfoTypeForString('IMPROVEMENT_FOREST'):
			pPlot.setFeatureType(gc.getInfoTypeForString('FEATURE_FOREST'),0)
			pPlot.setImprovementType(-1)
		if iImprovement == gc.getInfoTypeForString('IMPROVEMENT_XENOFUNGUS'):
			pPlot.setFeatureType(gc.getInfoTypeForString('FEATURE_XENOFUNGUS'),0)
			pPlot.setImprovementType(-1)
		if iImprovement == gc.getInfoTypeForString('IMPROVEMENT_SEA_FUNGUS'):
			pPlot.setFeatureType(gc.getInfoTypeForString('FEATURE_SEA_FUNGUS'),0)
			pPlot.setImprovementType(-1)
